﻿@model TuanAnhPersonalWeb.Models.EmployeeModel

@{
    ViewBag.Title = "Edit Employee";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

<h2>Create</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true,"Edit new Employee Failed")
   
   <table>
   <tr>
   <td>
   @Html.HiddenFor(m => m.EMP_ID)
   @Html.HiddenFor(m => m.ISHOMEPAGE)
        <div class="editor-label">
            @Html.LabelFor(model => model.EMP_NAME)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.EMP_NAME)
            @Html.ValidationMessageFor(model => model.EMP_NAME)
        </div>
        </td>
        <td>
        <div class="editor-label">
            @Html.LabelFor(model => model.EMP_AGE)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.EMP_AGE)
            @Html.ValidationMessageFor(model => model.EMP_AGE)
        </div>
        </td>
         </tr>
         <tr>
        <td>
        <div class="editor-label">
            @Html.LabelFor(model => model.EMP_TITLE)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.EMP_TITLE)
            @Html.ValidationMessageFor(model => model.EMP_TITLE)
        </div>
        </td>
        <td>
        <div class="editor-label">
            @Html.LabelFor(model => model.POS_ID)
        </div>
        <div class="editor-field">
          @Html.DropDownListFor(model => model.POS_ID, ViewData["Positions"] as SelectList, "Chọn Phòng Ban", new { style = "width:160px", id = "Position_" })
           @Html.ValidationMessageFor(model => model.POS_ID)
        </div>
        </td>
        </tr>
       
         <tr>
         <td>
        <div class="editor-label">
            @Html.LabelFor(model => model.EMP_INFO)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.EMP_INFO)
            @Html.ValidationMessageFor(model => model.EMP_INFO)
        </div>
        </td>
        </tr>
       <tr>
        <td>
        <div class="editor-label">
            @Html.LabelFor(model => model.EMP_IMAGE)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.EMP_IMAGE, new { id = "imgdir", @readonly = "true" })
            @Html.ValidationMessageFor(model => model.EMP_IMAGE)
        </div>
        </td>

        <td style="width:100%"> 
         <script type="text/javascript">
             var finder = new CKFinder();
             finder.selectActionFunction = ShowFileInfo;
             finder.basePath = '/ckfinder/';
             finder.create();
             config.defaultDisplayFilename = true;
             function ShowFileInfo(fileUrl, data) {
                 //var imgdir = document.getElementById("imgdir").value;
                 document.getElementById("imgdir").value = fileUrl;
                 var str = fileUrl.toString();
                 alert('Add Link Successfully. Please enter description on the left hand side of the screen!.');
             }
                
</script>
</td>
        
        </tr>
       
        </table>
        <p>
            <input type="submit" value="Save" />
        </p>
   
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>
